package com.songlanyun.common.supplychainapi.logistic;


import com.jxhh.ApiClient;
import com.songlanyun.common.supplychainapi.common.ApiRequestCommon;
import com.songlanyun.common.supplychainapi.logistic.model.Logistic;
import com.songlanyun.common.supplychainapi.logistic.model.LogisticFirms;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Component
public class ApiLogisticCommon {

    /**
     * 物流查询v2
     */
    private static final String LOGISTIC_URL = "/v2/logistic";
    /**
     * 获取物流公司列表V2
     */
    private static final String LOGISTIC_FIRMS_URL = "/v2/logistic/firms";

    @Resource
    private ApiRequestCommon request;

    /**
     * 物流查询v2
     *
     * @return
     */
    public Logistic logistic(Map<String, Object> params) {
        return request.exec(LOGISTIC_URL, ApiClient.RequestMethod.GET, params, Logistic.class, "物流查询");
    }

    /**
     * 获取物流公司列表V2
     *
     * @return
     */
    public LogisticFirms[] logisticFirms() {
        return request.exec(LOGISTIC_FIRMS_URL, ApiClient.RequestMethod.GET, new HashMap<>(), LogisticFirms[].class, "获取物流公司列表");
    }


}
